package io;

import com.sun.org.apache.xpath.internal.operations.Neg;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class PWDemo2 {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner scan=new Scanner(System.in);
        FileOutputStream fos=new FileOutputStream("/speak.txt");
        OutputStreamWriter osw= new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bw=new BufferedWriter(osw);
        PrintWriter pw=new PrintWriter(bw,true);//自动刷新
        while (true){
            System.out.println("输入内容:");
            String line=scan.nextLine();
            if("exit".equals(line)){
                break;
            }
            pw.println(line);
        }
        pw.close();
    }
}
